<template>
  <div>
    <h1>广告列表</h1>
    <table cellspacing="0" align="center">
      <tr v-for="i in from">
        <td>
          <a :href="i.site"><img :src="'http://127.0.0.1:8000'+i.picture" alt="" width="200px"></a>
        </td>
      </tr>
    </table>
    <button v-for="i in tpages" @click="get_adv(i)">{{ i }}</button>
  </div>
</template>

<script>
export default {
  name: "show_adv",
  data() {
    return {
      from: [],
      tpages: 0,
    }
  },
  methods: {
    get_adv(p) {
      this.$axios.get('users/adv/?p=' + p).then(res => {
        this.from = res.data.matter
        this.tpages = res.data.tpages
      })
    }
  },
  mounted() {
    this.get_adv(1)
  }
}
</script>

<style scoped>

</style>
